package entities;

import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.Transient;

import entities.VO.RodamientoStockVO;

@Entity
@DiscriminatorValue(value="RODSTOCK")
public class RodamientoStock extends Rodamiento {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Integer stock;
	private Boolean hasStockNuevo;
	
	public RodamientoStock(){}
	
	public RodamientoStock(Rodamiento rodamiento){
		this.setCaracteristicas(rodamiento.getCaracteristicas());
		this.setCodigo(rodamiento.getCodigo());
		this.setMarca(rodamiento.getMarca());
		this.setOrigen(rodamiento.getOrigen());
	}

	public void setStock(Integer stock) {
		this.stock = stock;
	}

	public Integer getStock() {
		return stock;
	}
	
	public Boolean getHasStockNuevo() {
		return hasStockNuevo;
	}

	public void setHasStockNuevo(Boolean hasStockNuevo) {
		this.hasStockNuevo = hasStockNuevo;
	}

	@Transient
	public RodamientoStockVO getVO(){
		RodamientoStockVO vo = new RodamientoStockVO(this.getId(),this.getCaracteristicas(),this.getCodigo(),this.getMarca(), this.getOrigen(), this.getStock());
		return vo;
	}

	public void setVO(RodamientoStockVO vo){
		if (vo.getId()!= null){
			this.setId(vo.getId());
		}
		this.setCaracteristicas(vo.getCaracteristicas());
		this.setCodigo(vo.getCodigo());
		this.setMarca(vo.getMarca());
		this.setOrigen(vo.getOrigen());
		this.setStock(vo.getStock());
	}
}
